'use strict';
const SequelizeAuto = require('sequelize-auto');
const yamlConf = require('../app/utils/YamlConf');
const conf = yamlConf.load('mysql');
const path = require('path');

const auto = new SequelizeAuto(conf.database, conf.username, conf.password, {
  host: conf.host,
  dialect: 'mysql',
  directory: path.resolve(__dirname, '../app/models'), // where to write files
  port: conf.port,
  caseModel: 'c', // convert snake_case column names to camelCase field names: user_id -> userId
  caseFile: 'c', // file names created for each model use camelCase.js not snake_case.js
  singularize: true, // convert plural table names to singular model names
  additional: {
    timestamps: false
  },
  // tables: ['table1', 'table2', 'myschema.table3'] // use all tables, if omitted
});

auto.run()
  .then()
  .catch(err => {
    console.log(err);
  });


